<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>MTB CAT1 Peripheral driver library: Run-time Configuration Functions</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><a href="http://www.cypress.com/"><img alt="Logo" src="IFXCYP_one-line.png"/></a></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">MTB CAT1 Peripheral driver library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__group__sar__functions__config.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Run-time Configuration Functions<div class="ingroups"><a class="el" href="group__group__sar.html">SAR          (SAR ADC Subsystem)</a> &raquo; <a class="el" href="group__group__sar__functions.html">Functions</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">General Description</h2>
<p>This set of functions allows changes to the SAR configuration after initialization. </p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gaabd68168933e0922c739ee8ebe3cddd6"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sar__functions__config.html#gaabd68168933e0922c739ee8ebe3cddd6">Cy_SAR_SetConvertMode</a> (<a class="el" href="struct_s_a_r___type.html">SAR_Type</a> *base, <a class="el" href="group__group__sar__sample__ctrl__register__enums.html#ga62ecb4e368dcea23cfbfc41bd0497fc6">cy_en_sar_sample_ctrl_trigger_mode_t</a> <a class="el" href="group__group__ipc__bt__data__structures.html#ga37e90f5e3bd99fac2021fb3a326607d4">mode</a>)</td></tr>
<tr class="memdesc:gaabd68168933e0922c739ee8ebe3cddd6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the mode in which conversions are triggered.  <a href="#gaabd68168933e0922c739ee8ebe3cddd6">More...</a><br /></td></tr>
<tr class="separator:gaabd68168933e0922c739ee8ebe3cddd6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga4808c2e7e72e2648c0efbf3eb025366f"><td class="memItemLeft" align="right" valign="top">__STATIC_INLINE void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sar__functions__config.html#ga4808c2e7e72e2648c0efbf3eb025366f">Cy_SAR_SetChanMask</a> (<a class="el" href="struct_s_a_r___type.html">SAR_Type</a> *base, uint32_t enableMask)</td></tr>
<tr class="memdesc:ga4808c2e7e72e2648c0efbf3eb025366f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the enable/disable mask for the channels.  <a href="#ga4808c2e7e72e2648c0efbf3eb025366f">More...</a><br /></td></tr>
<tr class="separator:ga4808c2e7e72e2648c0efbf3eb025366f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaff69993327b0aba19490c7ac9708138c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sar__functions__config.html#gaff69993327b0aba19490c7ac9708138c">Cy_SAR_SetLowLimit</a> (<a class="el" href="struct_s_a_r___type.html">SAR_Type</a> *base, uint32_t lowLimit)</td></tr>
<tr class="memdesc:gaff69993327b0aba19490c7ac9708138c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the low threshold for range detection.  <a href="#gaff69993327b0aba19490c7ac9708138c">More...</a><br /></td></tr>
<tr class="separator:gaff69993327b0aba19490c7ac9708138c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga1010c3aa3528648ac3715481c0339e28"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sar__functions__config.html#ga1010c3aa3528648ac3715481c0339e28">Cy_SAR_SetHighLimit</a> (<a class="el" href="struct_s_a_r___type.html">SAR_Type</a> *base, uint32_t highLimit)</td></tr>
<tr class="memdesc:ga1010c3aa3528648ac3715481c0339e28"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the high threshold for range detection.  <a href="#ga1010c3aa3528648ac3715481c0339e28">More...</a><br /></td></tr>
<tr class="separator:ga1010c3aa3528648ac3715481c0339e28"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga7fc7fe5bfdf2f43c218f839592f3afa8"><td class="memItemLeft" align="right" valign="top">__STATIC_INLINE void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sar__functions__config.html#ga7fc7fe5bfdf2f43c218f839592f3afa8">Cy_SAR_SetRangeCond</a> (<a class="el" href="struct_s_a_r___type.html">SAR_Type</a> *base, <a class="el" href="group__group__sar__range__thres__register__enums.html#gaccf649d65a86e17939c3d20a684cd9cd">cy_en_sar_range_detect_condition_t</a> cond)</td></tr>
<tr class="memdesc:ga7fc7fe5bfdf2f43c218f839592f3afa8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the condition in which range detection interrupts are triggered.  <a href="#ga7fc7fe5bfdf2f43c218f839592f3afa8">More...</a><br /></td></tr>
<tr class="separator:ga7fc7fe5bfdf2f43c218f839592f3afa8"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="gaabd68168933e0922c739ee8ebe3cddd6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaabd68168933e0922c739ee8ebe3cddd6">&#9670;&nbsp;</a></span>Cy_SAR_SetConvertMode()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Cy_SAR_SetConvertMode </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_s_a_r___type.html">SAR_Type</a> *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__sar__sample__ctrl__register__enums.html#ga62ecb4e368dcea23cfbfc41bd0497fc6">cy_en_sar_sample_ctrl_trigger_mode_t</a>&#160;</td>
          <td class="paramname"><em>mode</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set the mode in which conversions are triggered. </p>
<p>This function does not start any conversions; it only configures the mode for subsequent conversions.</p>
<p>There are three modes:</p><ul>
<li>firmware only; hardware triggering is disabled</li>
<li>firmware and edge sensitive hardware triggering</li>
<li>firmware and level sensitive hardware triggering</li>
</ul>
<p>Note that firmware triggering is always enabled.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>Pointer to structure describing registers</td></tr>
    <tr><td class="paramname">mode</td><td>A value of the enum <a class="el" href="group__group__sar__sample__ctrl__register__enums.html#ga62ecb4e368dcea23cfbfc41bd0497fc6">cy_en_sar_sample_ctrl_trigger_mode_t</a></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None</dd></dl>
<dl class="section user"><dt>Function Usage</dt><dd></dd></dl>
<div class="fragment"><div class="line">    </div><div class="line">    <span class="comment">/* Scenario: Allow a rising edge on a hardware trigger signal to initiate</span></div><div class="line"><span class="comment">     * a single conversion. FW triggering is still supported. The trigger signal</span></div><div class="line"><span class="comment">     * can come from a device pin or an internal block. Make sure route the hardware signal</span></div><div class="line"><span class="comment">     * to the SAR trigger input. */</span></div><div class="line">    </div><div class="line">    <a class="code" href="group__group__sar__functions__config.html#gaabd68168933e0922c739ee8ebe3cddd6">Cy_SAR_SetConvertMode</a>(SAR_HW, <a class="code" href="group__group__sar__sample__ctrl__register__enums.html#gga62ecb4e368dcea23cfbfc41bd0497fc6a7eed8528ba801da55b7727c170d361e1">CY_SAR_TRIGGER_MODE_FW_AND_HWEDGE</a>);</div><div class="line">    </div></div><!-- fragment -->
</div>
</div>
<a id="ga4808c2e7e72e2648c0efbf3eb025366f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga4808c2e7e72e2648c0efbf3eb025366f">&#9670;&nbsp;</a></span>Cy_SAR_SetChanMask()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">__STATIC_INLINE void Cy_SAR_SetChanMask </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_s_a_r___type.html">SAR_Type</a> *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>enableMask</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set the enable/disable mask for the channels. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>Pointer to structure describing registers</td></tr>
    <tr><td class="paramname">enableMask</td><td>Channel enable/disable mask. Each bit corresponds to a channel.<ul>
<li>0: the corresponding channel is disabled.</li>
<li>1: the corresponding channel is enabled; it will be included in the next scan.</li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None</dd></dl>
<dl class="section user"><dt>Function Usage</dt><dd></dd></dl>
<div class="fragment"><div class="line">    <span class="comment">/* Scenario: Channels 0 and 1 have been configured during initialization.</span></div><div class="line"><span class="comment">     * Channel 1 only needs to be scanned periodically. Disable it and only scan channel 0. */</span></div><div class="line">    </div><div class="line">    <a class="code" href="group__group__sar__functions__config.html#ga4808c2e7e72e2648c0efbf3eb025366f">Cy_SAR_SetChanMask</a>(SAR_HW, 1UL);</div><div class="line">    </div></div><!-- fragment -->
</div>
</div>
<a id="gaff69993327b0aba19490c7ac9708138c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaff69993327b0aba19490c7ac9708138c">&#9670;&nbsp;</a></span>Cy_SAR_SetLowLimit()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Cy_SAR_SetLowLimit </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_s_a_r___type.html">SAR_Type</a> *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>lowLimit</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set the low threshold for range detection. </p>
<p>The values are interpreted as signed or unsigned according to the channel configuration. Range detection is done on the value stored in the result register. That is, after averaging, shifting sign extension, and left/right alignment.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>Pointer to structure describing registers</td></tr>
    <tr><td class="paramname">lowLimit</td><td>The low threshold for range detection</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None</dd></dl>
<dl class="section user"><dt>Function Usage</dt><dd></dd></dl>
<div class="fragment"><div class="line">    </div><div class="line">    <span class="comment">/* Scenario: Range detection interrupts have been enabled for all unsigned channels.</span></div><div class="line"><span class="comment">     * Adjust the the low limit of the range detection to 0x300 and the high limit to 0xC00. */</span></div><div class="line">    </div><div class="line">    <a class="code" href="group__group__sar__functions__config.html#gaff69993327b0aba19490c7ac9708138c">Cy_SAR_SetLowLimit</a>(SAR_HW, 0x300UL);</div><div class="line">    <a class="code" href="group__group__sar__functions__config.html#ga1010c3aa3528648ac3715481c0339e28">Cy_SAR_SetHighLimit</a>(SAR_HW, 0xC00UL);</div><div class="line">    </div></div><!-- fragment -->
</div>
</div>
<a id="ga1010c3aa3528648ac3715481c0339e28"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga1010c3aa3528648ac3715481c0339e28">&#9670;&nbsp;</a></span>Cy_SAR_SetHighLimit()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Cy_SAR_SetHighLimit </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_s_a_r___type.html">SAR_Type</a> *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>highLimit</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set the high threshold for range detection. </p>
<p>The values are interpreted as signed or unsigned according to the channel configuration. Range detection is done on the value stored in the result register. That is, after averaging, shifting sign extension, and left/right alignment.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>Pointer to structure describing registers</td></tr>
    <tr><td class="paramname">highLimit</td><td>The high threshold for range detection</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None</dd></dl>
<dl class="section user"><dt>Function Usage</dt><dd></dd></dl>
<div class="fragment"><div class="line">    </div><div class="line">    <span class="comment">/* Scenario: Range detection interrupts have been enabled for all unsigned channels.</span></div><div class="line"><span class="comment">     * Adjust the the low limit of the range detection to 0x300 and the high limit to 0xC00. */</span></div><div class="line">    </div><div class="line">    <a class="code" href="group__group__sar__functions__config.html#gaff69993327b0aba19490c7ac9708138c">Cy_SAR_SetLowLimit</a>(SAR_HW, 0x300UL);</div><div class="line">    <a class="code" href="group__group__sar__functions__config.html#ga1010c3aa3528648ac3715481c0339e28">Cy_SAR_SetHighLimit</a>(SAR_HW, 0xC00UL);</div><div class="line">    </div></div><!-- fragment -->
</div>
</div>
<a id="ga7fc7fe5bfdf2f43c218f839592f3afa8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga7fc7fe5bfdf2f43c218f839592f3afa8">&#9670;&nbsp;</a></span>Cy_SAR_SetRangeCond()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">__STATIC_INLINE void Cy_SAR_SetRangeCond </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_s_a_r___type.html">SAR_Type</a> *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__sar__range__thres__register__enums.html#gaccf649d65a86e17939c3d20a684cd9cd">cy_en_sar_range_detect_condition_t</a>&#160;</td>
          <td class="paramname"><em>cond</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set the condition in which range detection interrupts are triggered. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>Pointer to structure describing registers</td></tr>
    <tr><td class="paramname">cond</td><td>A value of the enum <a class="el" href="group__group__sar__range__thres__register__enums.html#gaccf649d65a86e17939c3d20a684cd9cd">cy_en_sar_range_detect_condition_t</a>.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None</dd></dl>
<dl class="section user"><dt>Function Usage</dt><dd></dd></dl>
<div class="fragment"><div class="line">    </div><div class="line">    <span class="comment">/* Scenario: Range detection interrupts have been enabled for all unsigned channels.</span></div><div class="line"><span class="comment">     * Set the range condition to be outside; a range interrupt is detected</span></div><div class="line"><span class="comment">     * when (result &lt; lowLimit) || (highLimit &lt;= result). */</span></div><div class="line">    <a class="code" href="group__group__sar__functions__config.html#ga7fc7fe5bfdf2f43c218f839592f3afa8">Cy_SAR_SetRangeCond</a>(SAR_HW, <a class="code" href="group__group__sar__range__thres__register__enums.html#ggaccf649d65a86e17939c3d20a684cd9cda05ef1644deb92e634e163532a3b2179e">CY_SAR_RANGE_COND_OUTSIDE</a>);</div><div class="line">    </div></div><!-- fragment -->
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part
<div id="nav-path" class="navpath">
    <ul>
        <li class="footer">
            Generated for <b>MTB CAT1 Peripheral driver library</b> by <b>Cypress Semiconductor Corporation</b>.
            All rights reserved.
        </li>
    </ul>
</div>
-->
</body>
</html>
